import React from 'react'
import { FormItem } from '../../../components/VForm/interface'
import VForm from '../../../components/VForm'
import { Button, Form, message } from 'antd'

import './index.css'
import { SumbitFleetInfo } from './service'


export default function FleetInfo() {
  const [form] = Form.useForm()
  const formItems: FormItem[] = [
 
    {
      name: 'fleet_name',
      label: '车队名称',
      required: true,
      type: 'input'
    }
  ]
  const handleSumbit = async () => {
    const values=form.getFieldsValue();
    /** 接口 */
    await SumbitFleetInfo(values).then(res=>{
      if(res.data.result==="SUCCESS"){
        message.success('提交成功');
      }
      else{
        message.error(res.data.message);
      }
    })
  }
  return (
    <div className="Vform-container">
      <div className="Vform">
        <VForm formItems={formItems} form={form} />
      </div>

      <div className="sumbit-btn">
        <Button type="primary" onClick={handleSumbit}>
          提交
        </Button>
      </div>
    </div>
  )
}
